class PaBaseModel {
  constructor(source) {
    let sourceCopy = angular.copy(source);
    for(let key in sourceCopy){
      this[key] = sourceCopy[key];
    }
    this._originData = source;
  }
  // 可编辑数据重置为初始数据
  $reset() {
    let originData = this._originData;
    for(let key in originData){
      this[key] = originData[key];
    }
  }
  // 保存可编辑数据到主model
  $sync() {
    for(let key in this._originData){
      this._originData[key] = this[key];
    }
  }
}

export default PaBaseModel;
